package com.aliwo.service.impl;

import com.aliwo.domain.Video;
import com.aliwo.mapper.VideoMapper;
import com.aliwo.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * .
 *
 * @author xuyayuan
 * @date 2021/10/17 11:19
 */
@Service
@Transactional(rollbackFor = Exception.class, readOnly = true)
public class VideoServiceImpl implements VideoService {

    @Autowired
    private VideoMapper videoDao;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public Integer save(Video video) {
        return videoDao.save(video);
    }

    @Override
    public List<Video> findAll() {
        return videoDao.findAll();
    }

    @Override
    public Video findById(Integer id) {
        return videoDao.getVideoById(id);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean update(Video video) {
        return videoDao.update(video);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean delete(Integer id) {
        return videoDao.delete(id);
    }
}
